<%@include file="/WEB-INF/header.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<script>
   function del(){
	   return confirm("确定要删除本条信息");
   }
   //修改页面跳转
   function update(param){
		window.location.href="${ pageContext.request.contextPath }/manage/editmanager.action?mediaid="+param;
		                     
   }

</script>

<div class="container-fluid">
	<div class="row">
		<div class="col-md-2">
			<%@include file="../../tree.jsp"%>
		</div>
		<div class="col-md-10">
			<h2>
				媒体管理 
				<a href="${pageContext.request.contextPath }/manage/management.action" class="btn btn-primary btn-sm" role="button">新建分类</a>
			</h2>

			<div class="table-responsive">

				<table class="table table-striped table-sm">
					<thead>
						<tr>
							<th>媒体类型</th>
							<th>媒体预览</th>
							<th>标题</th>
							<th>描述</th>
							<th>分类</th>
							<th>拍摄时间</th>
							<th>是否开放</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
						<c:if test="${empty pageInfo}">
							<c:set var="list" scope="page" value="${pageInfo.list}" />
						</c:if>
						<c:if test="${not empty pageInfo}">
							<c:set var="list" scope="page" value="${list}" />
						</c:if>
						<c:forEach items="${pageInfo.list}" var="l">
							<tr>
								<td><c:if test="${l.mediatype=='P'}">图片</c:if>
									<c:if test="${l.mediatype=='V'}">视频</c:if>
									</td>
								<td><c:if test="${l.mediatype=='P'}">
										<img src="${pageContext.request.contextPath }${l.mediaurl}"
											class="img-rounded-list" width="100px">
									</c:if> <c:if test="${l.mediatype=='V'}">
										<video
											<%--poster="${pageContext.request.contextPath }${l.vedioimageurl}"--%>
											controls width="100px">
											<source
												src="${pageContext.request.contextPath }${l.mediaurl}"
												type='video/mp4; codecs="avc1.4D401E, mp4a.40.2"'>
										</video>
									</c:if></td>
								<td>${l.mediatitle}</td>
								<td>${l.description}</td>
								<td>${l.typename}</td>
								
								<td><fmt:formatDate value="${l.screendate}" pattern="yyyy-MM-dd" /></td>
								<td><c:if test="${l.isopen=='1'}">是</c:if>
									<c:if test="${l.isopen=='0'}">否</c:if></td>
								<td>
								<a  class="btn btn-primary btn-xs"
									role="button" onclick="update(${l.mediaid})" >修改</a> 
									<a href="${pageContext.request.contextPath }/manage/delete.action?mediaid=${l.mediaid}" class="btn btn-primary btn-xs"
									role="button" onclick="del()">删除</a></td>
							</tr>
						</c:forEach>
					</tbody>
				</table>
				<c:if test="${not empty pageInfo.list}">
					<%@include file="../../pagebar.jsp"%>
				</c:if>


			</div>
		</div>

		<%@include file="/WEB-INF/footer.jsp"%>